<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>修改签章</title>
 <link href="css/table.css" rel="stylesheet" type="text/css" />
 <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
 <script type="text/javascript" src="js/openwindow.js"></script>
 <script type="text/javascript">
 function setValue(value,val){
	  var arr = eval(value);
	  var names = "";
	  var ids = "";
	  for(i=0;i<arr.length;i++){
	    ids =  ids + "," + arr[i].value;
	    names = names + "," + arr[i].name;
	  }
	  if(names.length>0){
	    names = names.substring(1);
	    ids =  ids.substring(1);
	  }
	  document.getElementById(val+"names").value=names;
	  document.getElementById(val+"ids").value=ids;
	}
	
	function selectUser(val){
		var url="getGrouphome.action?status="+val;
		openWindow(url,700,400);
	}
function getOldValue(val){
	  var ids=document.getElementById(val+"ids").value;
  	  var names=document.getElementById(val+"names").value;
      var array="";
  if(ids!=''&&ids!='null'){
  var idarray=ids.split(",");
  var namearray=names.split(",");
  for(var i=0;i<idarray.length;i++){
  		if(i==0){
  			array+="{\"value\":"+idarray[i]+",\"name\":\""+namearray[i]+"\"}";
  		}else{
  	      array+=",{\"value\":"+idarray[i]+",\"name\":\""+namearray[i]+"\"}";
  	   } 
  }
  }
	  return array;
	}
	
	function selectorg(val){
		var url="orgByFlow.action?status="+val;
		openWindow(url,650,550);
	}
 
function saveMark(){
	var name =$("#name").val();
	var px=$("#px").val();
	var reg=/^[1-9]\d*$/;	
	if($.trim(name)=='null' ||$.trim(name)==''){
		alert("签章名称不能为空！");
		return false;
	}
	if($.trim(px)=='null' ||$.trim(px)==''){
		alert("签章排序不能为空！");
		return false;
	}else{
		if(!reg.test(px)){
		alert("签章排序只能是数字！");
		return false;
		}
	}
}	
 </script>
</head>
<body>
<table align="center" border="0" cellpadding="0" cellspacing="0" width="98%">
  <tbody>
  <tr>
    <td style="background: url('image/wsoa_window_002.gif');" width="1"></td>
    <td style="background: url('image/wsoa_window_002.gif');"><table border="0" cellpadding="0" cellspacing="0">
      <tbody><tr>
        <td align="center" style="background: url('image/wsoa_window_002.gif');" width="10"><img src="image/center_19.gif"></td>
        <td align="center" style="background: url('image/wsoa_window_002.gif');"></td>
        <td>系统管理 &gt; 模板管理 &gt; 签章管理 &gt;<a href="bookMarkInit.action?status=save">添加</a></td>
        </tr>
    </tbody>
    </table></td>
    <td style="background: url('image/wsoa_window_002.gif');" width="1"></td>
  </tr>
  <tr>
    <td style="background: url('image/wsoa_window_010.gif');"  width="1">&nbsp;</td>
    <td>
    <form action="updateSignature.action" method="post" name="saveMemoForm"  enctype="multipart/form-data"  onsubmit="return saveMark()">
   	<input name="signature.signatureid" type="hidden"  value="${signature.signatureid}"/>
    <table width="100%" style="margin-top: 10px" class="table5 bgcolor5">
    	<tr><td  class="table5 bgcolor5" align="right">签章名称</td>
    	<td class="table5"  >
    		<input name="signature.markname" id="name" type="text" size="45" maxlength="15" value="${signature.markname}"/>
    	</td></tr>
    	<td  class="table5" align="right">签章排序</td>
    	<td class="table5"  >
    		<input name="signature.px" id="px" type="text" size="15" maxlength="10" value="${signature.px}"/>
    	</td></tr>
    	<tr>
			<td align="right"  class="table5">
				 适用范围
			</td>
			<td class="table5">
				<textarea readonly="readonly" id="onames" name="names" style="width:95%;height:30px;">${names }</textarea><br/>
		    	<input type="hidden" id="oids" name="orgs" value="${orgs}">
		    	&nbsp;<a href="javascript:selectorg('o')">添加部门</a>
			</td>
		</tr>
		<tr>
			<td align="right"  class="table5">
				  适用范围
			</td>
			<td  class="table5">
				<textarea readonly="readonly" id="snames" name="actornames" style="width:95%;height:30px;">${actornames }</textarea><br/>
		    	<input type="hidden" id="sids" name="actorids" value="${actorids}">
		    	&nbsp;<a href="javascript:selectUser('s')">添加人员</a>
			</td>
		</tr>
    	<tr>
    	<td class="table5" align="right">上传签章</td>
    	<td class="table5" >
			<input id="signaturePath" type="file" size="45" name="upload" value="" accept="image/gif, image/jpeg">
    	 </td></tr>
    	<tr>
    	<td align="center" colspan="2">
    	<input  class="button_02" value="保存" type="submit"  >
    	&nbsp;<input class="button_02" type="button" value="退出" onclick="window.close()" > 
    	</td></tr>
    </table>
    </form>
    </td>
<td style="background: url('image/wsoa_window_006.gif');"  width="1">&nbsp;</td></tr>
  <tr>
    <td height="1" width="1"><img src="image/wsoa_window_009.gif" height="16" width="14"></td>
    <td style="background: url('image/wsoa_window_008.gif');" height="1"></td>
    <td height="1" width="1"><img src="image/wsoa_window_007.gif" height="16" width="12"></td>
  </tr>
</tbody>
</table>
</body>
</html>